begincreaturescript;

variables;

short i,target,choice,whattosay;

body;

beginstate INIT_STATE;
break;

beginstate DEAD_STATE;
	reset_dialog();
	add_dialog_str(0,"Badly hurt, Nogan stops his assault.  He pleads, _PLEASE DON'T KILL ME, I'VE GOT A WIFE AND THREE PUPILS!  I'LL STOP EVERYTHING AND LEAVE, PLEASE JUST DON'T HURT ME ANYMORE!_",0);
	add_dialog_str(1,"Your mission is to 'kill them dead.'  Somehow, it seems 'not killing' Nogan would interfere with your goal.",0);
	add_dialog_str(2,"Kill him dead?",0);
	add_dialog_choice(0,"What The Boss doesn't know can't hurt him. (or my paycheck)");
	add_dialog_choice(1,"And risk losing some obscure but precious and possibly overpowered artifact the creator gave this squishy thing?  No way!");
	choice = run_dialog(1);

	if(choice == 2){
		message_dialog("You kill him dead.","");

		force_view_center(char_loc_x(ME),char_loc_y(ME));
		force_instant_terrain_redraw();

		text_bubble_on_char(ME,"CURSES!");
		force_instant_terrain_redraw();
		pause(20);

		text_bubble_on_char(ME,"");
		text_bubble_on_char(ME,"PAIN, MY ONLY WEAKNESS!");
		force_instant_terrain_redraw();
		pause(30);

		text_bubble_on_char(ME,"");
		text_bubble_on_char(ME,"and now...");
		force_instant_terrain_redraw();
		pause(12);

		text_bubble_on_char(ME,"");
		text_bubble_on_char(ME,"I die.");
		force_instant_terrain_redraw();
		pause(15);

		text_bubble_on_char(ME,"");
		force_instant_terrain_redraw();
		pause(4);

		force_view_center(char_loc_x(0),char_loc_y(0));
		force_instant_terrain_redraw();

		inc_flag(10,10,1);
		}
		else{
			message_dialog("You draw your weapons and let the guy go.  He squishes and squashes away as fast as he can.","");
			erase_char(ME);
			}
	set_flag(3,10,1);
break;

beginstate START_STATE; 
	// if I have a target for some reason, go attack it
	if (target_ok()) {
		if (dist_to_char(get_target()) <= 16)
			set_state(3);
			else set_target(ME,-1);
		}
	
	// Look for a target, attack it if visible
	if (select_target(ME,8,0)) {
		do_attack();
		set_state(3);
		}
		
	// Have I been hit? Strike back!
	if (who_hit_me() >= 0) {
		set_target(ME,who_hit_me());
		do_attack();
		set_state(3);
		}

	// if we're in combat and the above didn't give me anything to do, just
	// stop now. Otherwise, game will keep running script, and that eats up CPU time.
	if (am_i_doing_action() == FALSE)
		end_combat_turn();

	whattosay = get_ran(1,0,9);

	if (whattosay == 0)
		text_bubble_on_char(ME,"*splort*");
	if (whattosay == 9)
		text_bubble_on_char(ME,"*squish*");
break;

beginstate 3; // attacking
	if (target_ok() == FALSE)
		set_state(START_STATE);

	whattosay = get_ran(1,0,9);

	if (whattosay == 0)
		text_bubble_on_char(ME,"*splort*");
	if (whattosay == 9)
		text_bubble_on_char(ME,"*squish*");

	do_attack();
break;


beginstate TALKING_STATE;
	print_str("Talking: Snootfairy doesn't respond.");
break;